<template>
  <Fieldset legend="List" :toggleable="true">
    <div class="mb-1 text-sm font-semibold text-surface-950 dark:text-surface-0">Option</div>
    <section class="grid grid-cols-4 mb-3 gap-2">
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.focusBackground" label="Focus BG" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.selectedBackground" label="Selected BG" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField
          v-model="colorScheme.list.option.selectedFocusBackground"
          label="Selected Focus BG"
          type="color"
        />
      </div>
      <div class="flex flex-col gap-1"></div>
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.color" label="Color" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.selectedColor" label="Selected Color" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField
          v-model="colorScheme.list.option.selectedFocusColor"
          label="Selected Focus Color"
          type="color"
        />
      </div>
      <div class="flex flex-col gap-1"></div>
    </section>

    <div class="mb-1 text-sm font-semibold text-surface-950 dark:text-surface-0">Option Icon</div>
    <section class="grid grid-cols-4 mb-3 gap-2">
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.icon.color" label="Color" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.option.icon.focusColor" label="Focus Color" type="color" />
      </div>
    </section>

    <div class="mb-1 text-sm font-semibold text-surface-950 dark:text-surface-0">Option Group</div>
    <section class="grid grid-cols-4 gap-2">
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.optionGroup.background" label="BG" type="color" />
      </div>
      <div class="flex flex-col gap-1">
        <DesignTokenField v-model="colorScheme.list.optionGroup.color" label="Color" type="color" />
      </div>
      <div class="flex flex-col gap-1"></div>
      <div class="flex flex-col gap-1"></div>
    </section>
  </Fieldset>
</template>

<script setup lang="ts">
  import { inject, type Ref } from 'vue'
  import DesignTokenField from '../../base/DesignTokenField.vue'

  interface OptionIcon {
    color: string
    focusColor: string
  }

  interface Option {
    focusBackground: string
    selectedBackground: string
    selectedFocusBackground: string
    color: string
    selectedColor: string
    selectedFocusColor: string
    icon: OptionIcon
  }

  interface OptionGroup {
    background: string
    color: string
  }

  interface List {
    option: Option
    optionGroup: OptionGroup
  }

  interface ColorScheme {
    list: List
    value: any
  }

  const colorScheme = inject('$colorScheme') as Ref<ColorScheme>
</script>
